
<?php
defined('BASEPATH') OR exit('No direct script access allowed');

class Ciblog extends CI_Controller {
	public $navs;
	public function __construct(){
		parent::__construct();
		$this->load->model("Nav_model");
		$this->navs=$this->Nav_model->get_entries();
		$this->load->model("Catalog_model");
		$this->catalogs=$this->Catalog_model->get_entries();
		$this->load->model("Article_model");
	}

	public function index(){
		$articles=$this->Article_model->get_entries();
		$data=array(
			'navs'=>$this->navs,
			'catalogs'=>$this->catalogs,
			'articles'=>$articles
			);
		$this->load->view("ciblog/Header");
		$this->load->view("ciblog/Nav_index",$data);
		$this->load->view("ciblog/Article_index",$data);
		$this->load->view("ciblog/Footer.php");
	}
	public function view($id){
		//$this->output->enable_profiler(true);//在view页面中显示debug
		$this->Article_model->view_once($id);
		$article=$this->Article_model->get_one($id);
		$data=array(
			'navs'=>$this->navs,
			'article'=>$article
			);
		$this->load->view("ciblog/Header");
		$this->load->view("ciblog/Article_view",$data);
		$this->load->view("ciblog/Footer");
	}
	public function lists($cata_id){
		$articles=$this->Article_model->get_by_cata_id($cata_id);
		$data=array(
			'navs'=>$this->navs,
			'catalogs'=>$this->catalogs,
			'articles'=>$articles,
			);
		$this->load->view("ciblog/Header.php");
		$this->load->view("ciblog/Nav_index.php",$data);
		$this->load->view("ciblog/Article_index.php",$data);
		$this->load->view("ciblog/Footer.php");
	}
}
